 package  {
        
        import flash.display.Sprite;
        import flash.display.DisplayObjectContainer;
        import flash.utils.Timer;
        import flash.events.TimerEvent;
        import flash.geom.Point;
        
        public class Checker extends Sprite {
                
                private var owner      : int;
                private var dest_pixel : Point;
                private var timer      : Timer;

                public function Checker( owner : int, dest : Point ) {
                        
                        this.owner = owner;
                        
                        this.dest_pixel = dest.clone();
                        
                        this.x = this.dest_pixel.x;
                        this.y = 0;
                        
                        this.createDisplayList();
                        
                }
                
                public function createDisplayList() : void {
                        
                        this.graphics.clear()
                        
                        if ( this.owner == 1 ) {
                                
                                this.graphics.beginFill( 0xFF0000 );
                                
                        }
                        else {
                                
                                this.graphics.beginFill( 0x000000 );
                                
                        }
                        
                        this.graphics.drawCircle( dest_pixel.x, 0, 25 );
                        this.graphics.endFill();
                        
                        timer = new Timer( 8 );
                        timer.addEventListener( TimerEvent.TIMER, this.descend );
                        timer.start();
                        
                }
                
                public function descend( e : TimerEvent ) : void {
                        
                        if ( this.dest_pixel.y > this.y ) {
                                
                                this.y += 3;
                                
                        }
                        else {
                                
                                this.y = this.dest_pixel.y;
                                timer.removeEventListener( TimerEvent.TIMER, this.descend );
                                
                        }
                        
                }
                
                public function getOwner() : int {
                        
                        return this.owner;
                        
                }

        }
        
}